home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
- Subject: Re: C/C++ knocks the crap out of Ada
- Date: 08 Mar 1996 01:03:21 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Mar7180321@qcd.lanl.gov>
- References: <00001a73+00002504@msn.com> <1996Feb22.005518.13396@leeweyr.sccsi.com>
- <4gvrffINNlqo@anvil.ugrad.cs.ubc.ca> <4h5hgj$vpd@tomquartz.niestu.com>
- <4h7jskINNnph@anvil.ugrad.cs.ubc.ca> <313EDF38.61C1@lfwc.lockheed.com>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: Ken Garlington's message of Thu, 07 Mar 1996 13:06:01 +0000
-
- In article <313EDF38.61C1@lfwc.lockheed.com>
- Ken Garlington <GarlingtonKE@lfwc.lockheed.com> writes:
-
- KG: Kazimir Kylheku wrote:
- KG: >
- KG: > This is false. There are compilers which offer range
- checking. In a situation
- KG: > where safety-critical software is designed, such a compiler
- should be used.
- KG:
- KG: I thought you were arguing the merits of two languages. Does the C
- _language_
- KG: standard define the syntax and sematics of built-in range
- checking? Or does
- KG: "language" in your lexicon include a particular C compiler, with
- all the add-on
- KG: tools that one could buy to get it to behave closer to a _standard_ Ada
- KG: implementation? This is the classic non-argument with regard to
- languages - that
- KG: a language can be "fixed up" with enough non-standard tools to do
- what another
- KG: language has standardized. It's probably true, but it's not a fair
- _language_
- KG: comparison.
-
- To be precise, C standard declares all programs that violate array
- bounds as illegal, but does not _require_ the compiler to check for
- these violations. This is a change from pre-standard days when a
- program was considered valid as long as it did not try to access
- memory beyond what was allocated to it.
-
- As an example,
-
- char a2[100][100];
- char *a = &a2[0][0];
-
- It is obvious from the constraints of memory layout for arrays and
- pointer arithmetic, that a+200 would have pointed to a[2][0] if it
- were valid. However, the standard has declared a+200 to invoke
- undefined behaviour. Thus, a very strict bounds checking
- implementation can reject such pointer arithmetic without violating
- the standard.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-